﻿#ifndef PLAYER_H
#define PLAYER_H 
#include <iostream>
#include "SocketHead.hpp"

class Player
{
private:
    std::string name,account;
    int sock_fd;
    sockaddr_in clnt_addr;
public:
    std::string message;
    bool isLogined;
    Player();
    Player(int sockFd,sockaddr_in clntAddr,std::string namne,std::string account);    
    Player(int sockFd,sockaddr_in clntAddr);   
    void Login(std::string namne,std::string account) ;

    std::string Name();
    std::string Account();
    sockaddr_in Addr();

    ~Player();
};



#endif // !PLAYER_H


Player::Player(int sockFd,sockaddr_in clntAddr,std::string namne,std::string account)
{
    isLogined=true;//账户登录
    sock_fd=sockFd;
    clnt_addr=clntAddr;
    this->name=name;
    this->account=account;
}

Player::Player(int sockFd,sockaddr_in clntAddr)
{
    isLogined=false;//账户无信息，未进行登录
    sock_fd=sockFd;
    clnt_addr=clntAddr;
}
       
void Player::Login(std::string name,std::string account){
    isLogined=true;//账户登录
    this->name=name;
    this->account=account;
}

std::string Player::Name(){
    return name;
}
std::string Player::Account(){
    return account;
}
sockaddr_in Player::Addr(){
    return clnt_addr;
}
Player::Player()
{
    
}
Player::~Player()
{
}